Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(auth-admin): Check if delegation already exists. #16420

Merged
merged 6 commits into from
Oct 17, 2024

Conversation

GunnlaugurG
Copy link
Member

@GunnlaugurG GunnlaugurG commented Oct 16, 2024

What

Check if delegation exists before trying to insert it to the db

Why

To return relevant error messages.

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Enhanced delegation management with new validation checks to prevent duplicate delegations based on national IDs and reference IDs.
    • Introduced new error messages for better localization and user feedback when delegation creation fails.
  • Bug Fixes

    • Improved API responses for scenarios where delegation creation fails due to existing entries.

@GunnlaugurG GunnlaugurG requested review from a team as code owners October 16, 2024 10:40
Copy link
Contributor

coderabbitai bot commented Oct 16, 2024

Walkthrough

The changes in this pull request enhance the delegation management API by adding new test cases for the POST /delegation-admin endpoint. Two tests were introduced to ensure that delegations cannot be created if they already exist based on national IDs or reference IDs. Additionally, new error messages were defined to support these validation scenarios, improving the localization of error handling related to delegation creation.

Changes

File Change Summary
apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.spec.ts Added two new test cases for the POST /delegation-admin endpoint to check for existing delegations.
libs/portals/admin/delegation-admin/src/lib/messages.ts Added new message definitions for couldNotCreateDelegationError and referenceIdAlreadyExistsError.

Possibly related PRs

Suggested labels

automerge, high priority

Suggested reviewers

  • Herdismaria
  • saevarma

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3123866 and e6244eb.

📒 Files selected for processing (2)
  • apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.spec.ts (2 hunks)
  • libs/portals/admin/delegation-admin/src/lib/messages.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.spec.ts
  • libs/portals/admin/delegation-admin/src/lib/messages.ts
🧰 Additional context used
📓 Learnings (1)
📓 Common learnings
Learnt from: saevarma
PR: island-is/island.is#16257
File: apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.auth.spec.ts:178-201
Timestamp: 2024-10-04T07:46:37.013Z
Learning: In `apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.auth.spec.ts`, ensure that test case names accurately describe the scenario being tested, particularly in cases involving invalid request signatures.
Learnt from: saevarma
PR: island-is/island.is#16257
File: apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.auth.spec.ts:178-201
Timestamp: 2024-10-08T15:39:04.351Z
Learning: In `apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.auth.spec.ts`, ensure that test case names accurately describe the scenario being tested, particularly in cases involving invalid request signatures.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (4)
libs/shared/utils/src/lib/errorCodes.ts (1)

9-10: LGTM! Consider adding documentation for new error codes.

The new error codes COULD_NOT_CREATE_DELEGATION and REFERENCE_ID_ALREADY_EXISTS are well-named and consistent with the existing enum entries. They align with the PR objective of improving error handling for delegation creation.

To enhance maintainability, consider adding a brief comment above each new error code explaining its specific use case. This would help other developers understand when and where these error codes should be used.

Example:

// Used when a delegation cannot be created due to an existing delegation
COULD_NOT_CREATE_DELEGATION = 'COULD_NOT_CREATE_DELEGATION',

// Used when attempting to create a delegation with a reference ID that already exists
REFERENCE_ID_ALREADY_EXISTS = 'REFERENCE_ID_ALREADY_EXISTS',
libs/auth-api-lib/src/lib/delegations/models/delegation.model.ts (1)

87-87: Improved type safety for domainName property

The change to allow null as a possible value for domainName improves type safety and clarity. This modification explicitly represents the absence of a value, which is a good TypeScript practice.

Consider updating other parts of the codebase that interact with this property to handle the null case explicitly. This might include:

  1. Updating any functions that use domainName to handle null values.
  2. Reviewing and updating unit tests to cover the null case.

Would you like me to search for usages of domainName in the codebase to identify potential areas that need updates?

apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.spec.ts (2)

342-379: LGTM! Consider adding a descriptive comment.

This test case effectively covers the scenario of preventing duplicate delegations based on national IDs. It follows NestJS testing practices and provides good coverage for the new functionality.

Consider adding a brief comment explaining the purpose of this test case at the beginning, for example:

// Test case to ensure that a delegation cannot be created if one already exists with the same national IDs

This would enhance the readability and maintainability of the test suite.


381-419: LGTM! Consider clarifying the test case name.

This test case effectively covers the scenario of preventing the creation of a delegation with an existing reference ID. It follows NestJS testing practices and provides good coverage for the new functionality.

The test case name mentions "delegation id", but it's actually checking for the "reference id". Consider renaming the test case for clarity:

it('POST /delegation-admin should not create delegation since the reference id already exists', async () => {

This would make the purpose of the test more immediately clear to other developers.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0b7c2c6 and 2751fc4.

📒 Files selected for processing (5)
  • apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.spec.ts (1 hunks)
  • libs/auth-api-lib/src/lib/delegations/admin/delegation-admin-custom.service.ts (2 hunks)
  • libs/auth-api-lib/src/lib/delegations/models/delegation.model.ts (1 hunks)
  • libs/services/auth/testing/src/fixtures/types.ts (1 hunks)
  • libs/shared/utils/src/lib/errorCodes.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.spec.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/auth-api-lib/src/lib/delegations/admin/delegation-admin-custom.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/auth-api-lib/src/lib/delegations/models/delegation.model.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/services/auth/testing/src/fixtures/types.ts (2)

Pattern libs/services/**/*: "Confirm that the code adheres to the following:

  • Shared services and modules that can be utilized across NestJS apps.
  • Proper implementation of NestJS providers, including custom providers.
  • Adherence to NestJS module encapsulation and isolation principles."

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/shared/utils/src/lib/errorCodes.ts (2)

Pattern libs/shared/**/*: "Confirm that the code adheres to the following:

  • Cross-application utility functions, types, and constants.
  • TypeScript best practices to ensure type safety and reusability.
  • Documentation and examples for library consumers."

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
📓 Learnings (1)
apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.spec.ts (2)
Learnt from: saevarma
PR: island-is/island.is#16257
File: apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.auth.spec.ts:178-201
Timestamp: 2024-10-04T07:46:37.013Z
Learning: In `apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.auth.spec.ts`, ensure that test case names accurately describe the scenario being tested, particularly in cases involving invalid request signatures.
Learnt from: saevarma
PR: island-is/island.is#16257
File: apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.auth.spec.ts:178-201
Timestamp: 2024-10-08T15:39:04.351Z
Learning: In `apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.auth.spec.ts`, ensure that test case names accurately describe the scenario being tested, particularly in cases involving invalid request signatures.
🔇 Additional comments (5)
libs/services/auth/testing/src/fixtures/types.ts (1)

40-46: LGTM: Addition of domainName enhances the CreateCustomDelegation type

The addition of the domainName property to the CreateCustomDelegation type is well-implemented and aligns with the PR objectives. This change enhances the delegation management API by allowing the inclusion of domain information in custom delegations.

The modification:

  1. Correctly adds domainName to the Pick utility type.
  2. Consistently includes domainName in the list of optional properties.
  3. Maintains proper TypeScript usage, ensuring type safety.

This localized change improves the type definition without affecting other parts of the file, promoting reusability across different NextJS apps.

libs/auth-api-lib/src/lib/delegations/models/delegation.model.ts (1)

Line range hint 1-180: Adherence to coding guidelines for libs directory

The file adheres to the coding guidelines for the libs directory:

  1. It uses TypeScript for defining props and exporting types.
  2. The Delegation class is potentially reusable across different NextJS apps.
  3. There are no obvious issues with tree-shaking or bundling practices.

To ensure the Delegation model is used correctly across the project, let's verify its usage:

This will help us understand how the Delegation model is used across different parts of the project and ensure its reusability.

✅ Verification successful

Adherence to coding guidelines for libs directory verified.

The Delegation model is correctly implemented and utilized across the project:

  • Widely imported and extended by multiple classes.
  • Consistently used in type annotations, ensuring type safety.
  • No evidence of removed or replaced code affecting functionality.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check usage of Delegation model across the project

# Search for imports of the Delegation model
echo "Searching for imports of the Delegation model:"
rg --type typescript "import.*Delegation.*from.*delegation\.model"

# Search for uses of the Delegation class
echo "\nSearching for uses of the Delegation class:"
rg --type typescript "new Delegation\(" -A 5

Length of output: 389


Script:

#!/bin/bash
# Description: Check usage of Delegation model across the project

# Search for imports of the Delegation model
echo "Searching for imports of the Delegation model:"
rg --type ts "import.*Delegation.*from.*delegation\.model"

# Search for uses of the Delegation class
echo "\nSearching for uses of the Delegation class:"
rg --type ts "new Delegation\(" -A 5

Length of output: 2106


Script:

#!/bin/bash
# Description: Further check usage patterns of Delegation model

# Search for class inheritance
echo "Searching for classes that extend Delegation:"
rg --type ts "extends Delegation"

# Search for static method calls on Delegation
echo "\nSearching for static method calls on Delegation:"
rg --type ts "Delegation\."

# Search for Delegation used as a type in type annotations
echo "\nSearching for Delegation used as a type in type annotations:"
rg --type ts ": Delegation\b"

Length of output: 15190

apps/services/auth/admin-api/src/app/v2/delegations/test/delegation-admin.spec.ts (1)

342-419: Excellent addition of test cases for duplicate delegation prevention.

These new test cases significantly enhance the robustness of the delegation creation process by covering scenarios where duplicates based on national IDs or reference IDs are attempted. They adhere well to NestJS testing practices and contribute to a more comprehensive test suite.

The additions align well with the PR objectives of implementing checks for existing delegations before insertion. These tests will help ensure that the new error handling for delegation insertion failures works as expected.

libs/auth-api-lib/src/lib/delegations/admin/delegation-admin-custom.service.ts (2)

32-32: Importing Op from sequelize is appropriate for query operators

The addition of Op enables the use of Sequelize operators in queries, which is necessary for the new validation logic.


307-319: Query logic correctly checks for existing delegations

The implemented query uses Op.or to check for existing delegations based on either matching fromNationalId and toNationalId, or matching referenceId. This effectively prevents duplicate delegations from being created.

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.72%. Comparing base (17e1369) to head (41021a9).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16420      +/-   ##
==========================================
- Coverage   36.75%   36.72%   -0.03%     
==========================================
  Files        6835     6835              
  Lines      141321   141330       +9     
  Branches    40235    40266      +31     
==========================================
- Hits        51940    51904      -36     
- Misses      89381    89426      +45     
Flag Coverage Δ
air-discount-scheme-backend 54.08% <100.00%> (+0.02%) ⬆️
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-domains-air-discount-scheme 36.93% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.48% <ø> (ø)
api-domains-communications 39.90% <100.00%> (+0.01%) ⬆️
api-domains-criminal-record 48.00% <ø> (ø)
api-domains-driving-license 44.43% <100.00%> (+0.03%) ⬆️
api-domains-education 31.58% <100.00%> (+0.06%) ⬆️
api-domains-health-insurance 34.77% <ø> (ø)
api-domains-mortgage-certificate 34.95% <ø> (ø)
api-domains-payment-schedule 41.16% <ø> (ø)
application-api-files 56.86% <100.00%> (+0.05%) ⬆️
application-core 71.64% <ø> (ø)
application-system-api 41.37% <100.00%> (+<0.01%) ⬆️
application-template-api-modules 27.86% <100.00%> (+0.01%) ⬆️
application-templates-accident-notification 29.27% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.34% <ø> (ø)
application-templates-driving-license 18.32% <ø> (ø)
application-templates-estate 12.32% <ø> (ø)
application-templates-example-payment 25.14% <ø> (ø)
application-templates-financial-aid 15.50% <ø> (ø)
application-templates-general-petition 23.44% <ø> (ø)
application-templates-inheritance-report 6.49% <ø> (ø)
application-templates-marriage-conditions 15.17% <ø> (ø)
application-templates-mortgage-certificate 43.82% <ø> (ø)
application-templates-parental-leave 29.96% <ø> (ø)
application-types 6.63% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.37% <ø> (ø)
auth-react 22.77% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.67% <ø> (ø)
clients-driving-license-book 43.80% <ø> (ø)
clients-financial-statements-inao 49.32% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
clients-middlewares 73.09% <100.00%> (-0.04%) ⬇️
clients-regulations 42.80% <ø> (ø)
clients-rsk-company-registry 29.76% <ø> (ø)
clients-syslumenn 49.44% <ø> (ø)
cms 0.42% <ø> (ø)
cms-translations 39.03% <100.00%> (+0.01%) ⬆️
contentful-apps 5.44% <ø> (ø)
download-service 44.22% <100.00%> (+0.03%) ⬆️
financial-aid-backend 56.37% <ø> (ø)
financial-aid-shared 18.94% <ø> (ø)
island-ui-core 28.39% <ø> (ø)
judicial-system-api 18.36% <ø> (ø)
judicial-system-backend 55.15% <100.00%> (+<0.01%) ⬆️
judicial-system-web 27.91% <ø> (ø)
license-api 42.69% <100.00%> (+0.04%) ⬆️
nest-aws ?
portals-admin-regulations-admin 1.85% <ø> (ø)
portals-core 16.15% <ø> (ø)
services-auth-admin-api 51.93% <100.00%> (+0.03%) ⬆️
services-auth-delegation-api 57.30% <40.00%> (-0.09%) ⬇️
services-auth-ids-api 51.41% <40.00%> (-0.03%) ⬇️
services-auth-personal-representative 45.14% <40.00%> (+0.01%) ⬆️
services-auth-personal-representative-public 41.27% <40.00%> (+<0.01%) ⬆️
services-auth-public-api 48.89% <40.00%> (-0.03%) ⬇️
services-endorsements-api 53.66% <100.00%> (+0.02%) ⬆️
services-university-gateway 48.37% <ø> (+0.08%) ⬆️
services-user-notification 47.02% <100.00%> (+0.04%) ⬆️
services-user-profile 62.12% <100.00%> (-0.06%) ⬇️
shared-components 27.65% <ø> (ø)
shared-form-fields 31.59% <ø> (ø)
shared-utils 27.69% <0.00%> (-0.22%) ⬇️
web 1.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...legations/admin/delegation-admin-custom.service.ts 79.50% <100.00%> (+1.24%) ⬆️
...lib/src/lib/delegations/models/delegation.model.ts 95.65% <100.00%> (ø)
libs/shared/utils/src/lib/errorCodes.ts 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17e1369...41021a9. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 16, 2024

Datadog Report

All test runs 41966dc 🔗

68 Total Test Services: 0 Failed, 65 Passed
🔻 Test Sessions change in coverage: 3 decreased, 7 increased, 190 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 81 0 34.27s N/A Link
air-discount-scheme-web 0 0 0 2 0 8.94s N/A Link
api 0 0 0 4 0 2.78s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 18.9s N/A Link
api-domains-assets 0 0 0 3 0 12.09s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 12.59s N/A Link
api-domains-communications 0 0 0 5 0 27.02s N/A Link
api-domains-criminal-record 0 0 0 5 0 8.59s 1 no change Link
api-domains-driving-license 0 0 0 23 0 36.37s N/A Link
api-domains-education 0 0 0 8 0 25.04s 1 increased (+0.06%) Link

🔻 Code Coverage Decreases vs Default Branch (3)

  • shared-utils - jest 28.57% (-0.25%) - Details
  • services-auth-delegation-api - jest 51.22% (-0.2%) - Details
  • clients-middlewares - jest 75.67% (-0.06%) - Details

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
libs/portals/admin/delegation-admin/src/lib/messages.ts (1)

162-169: LGTM! Consider exporting individual messages for better tree-shaking.

The new message definitions for couldNotCreateDelegationError and referenceIdAlreadyExistsError are correctly implemented and follow the existing patterns in the file. They are properly defined for internationalization and maintain consistency with other messages.

To improve tree-shaking and bundling practices, consider exporting individual messages instead of the entire object. This allows consumers to import only the messages they need. Here's an example of how you could refactor this:

export const couldNotCreateDelegationError = {
  id: 'admin.delegationAdmin:couldNotCreateDelegationError',
  defaultMessage: 'Umboð var ekki hægt að skrá',
};

export const referenceIdAlreadyExistsError = {
  id: 'admin.delegationAdmin:referenceIdAlreadyExistsError',
  defaultMessage: 'Númer máls í Zendesk er þegar til',
};

// ... other individual message exports

export const allMessages = {
  couldNotCreateDelegationError,
  referenceIdAlreadyExistsError,
  // ... other messages
};

This approach allows for more granular imports and better tree-shaking while maintaining the ability to import all messages if needed.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2751fc4 and 3123866.

📒 Files selected for processing (2)
  • libs/portals/admin/delegation-admin/src/constants/errors.ts (1 hunks)
  • libs/portals/admin/delegation-admin/src/lib/messages.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
libs/portals/admin/delegation-admin/src/constants/errors.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/portals/admin/delegation-admin/src/lib/messages.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (1)
libs/portals/admin/delegation-admin/src/constants/errors.ts (1)

15-16: LGTM! The new error codes enhance error handling for delegation creation.

The additions to the FORM_ERRORS constant are well-structured and consistent with the existing pattern. They directly support the PR's objective of improving error handling when checking for existing delegations. The use of TypeScript for defining the record type aligns with the coding guidelines for files in the libs directory.

These centralized error messages contribute to the reusability of components across different NextJS apps, which is a key guideline for code in the libs directory.

@GunnlaugurG GunnlaugurG added the automerge Merge this PR as soon as all checks pass label Oct 17, 2024
@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr added automerge Merge this PR as soon as all checks pass and removed automerge Merge this PR as soon as all checks pass labels Oct 17, 2024
@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr removed the automerge Merge this PR as soon as all checks pass label Oct 17, 2024
@GunnlaugurG GunnlaugurG added the automerge Merge this PR as soon as all checks pass label Oct 17, 2024
@kodiakhq kodiakhq bot merged commit d1c22d8 into main Oct 17, 2024
198 checks passed
@kodiakhq kodiakhq bot deleted the feat/handleAlreadyExists branch October 17, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants